<?php
/**
 * Created by PhpStorm.
 * User: fengdh
 * Date: 2019/8/20
 * Time: 17:24
 */

namespace search\controllers\platform;

use search\models\DeveloperSearchForm;
use yii\web\Controller;

class DeveloperController extends Controller
{
    /**
     * 平台开发商搜索
     */
    public function actionIndex()
    {
        $searchForm = new DeveloperSearchForm();
        $searchForm->attributes = array_map('common\utils\StringUtils::utf8_clean', $_GET);
        $resultSet = $searchForm->search();

        return $resultSet;
    }

    /**
     * 平台开发商Id搜索
     */
    public function actionInfo()
    {
        $developerId = \Yii::$app->request->get("developerId", "");
        if(!$developerId){
            return "";
        }
        $searchForm = new DeveloperSearchForm();
        $result = $searchForm->searchByDeveloperId($developerId);
        if(!$result){
            return "";
        }
        return $result["_source"];
    }

}